//
//  JYTMyInformationTableViewCell.m
//  JYT_IOS
//
//  Created by nxa-chengjinhui on 2017/1/4.
//  Copyright © 2017年 nxa-yuanguoxiang. All rights reserved.
//

#import "JYTMyInformationTableViewCell.h"

@implementation JYTMyInformationTableViewCell
{
    UIView *line;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.titLab = [[UILabel alloc] init];
        self.titLab.font = [UIFont boldSystemFontOfSize:14];
        self.titLab.adjustsFontSizeToFitWidth = YES;
        self.titLab.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:self.titLab];
        
        self.TitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//        self.TitBtn.frame = CGRectMake(CURRENT_SCREEN_WIDTH-120, 5, 90, self.bounds.size.height-10);
//        [self.TitBtn setTintColor:[UIColor colorWithRed:191/255.0 green:189/255.0 blue:189/255.0 alpha:1]];
        [self.TitBtn setTitleColor:[UIColor colorWithRed:191/255.0 green:189/255.0 blue:189/255.0 alpha:1] forState:UIControlStateNormal];
        self.TitBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.TitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        self.TitBtn.titleLabel.adjustsFontSizeToFitWidth = YES;
        [self.TitBtn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:self.TitBtn];
        
        self.imageview = [[UIImageView alloc] init];
        self.imageview.hidden = YES;
        [self.contentView addSubview:self.imageview];
        
        line = [[UIView alloc] init];
        line.backgroundColor = kColor(191, 189, 189);
        [self.contentView addSubview:line];
    }
    return self;
}

-(void)setTitile:(NSString *)name detail:(NSString *)detail{
   
    self.titLab.text = name;
    
//    [self.TitBtn setBackgroundImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:detail]]] forState:UIControlStateNormal];

    [self.TitBtn setTitle:detail forState:UIControlStateNormal];
}

- (void)layoutSubviews{
    [super layoutSubviews];
//    CGFloat width =self.bounds.size.width;
    CGFloat height =self.bounds.size.height;
    self.titLab.frame = CGRectMake(10, 10, CURRENT_SCREEN_WIDTH/7,height-20);
    self.TitBtn.frame = CGRectMake(CURRENT_SCREEN_WIDTH-120, 15, 90, height-30);
    self.imageview.frame = CGRectMake(CURRENT_SCREEN_WIDTH-100, 5, 50, 50);
    line.frame = CGRectMake(0,height-1 , CURRENT_SCREEN_WIDTH, 1);
}

-(void)btnClicked:(UIButton *)btn{
    if (_delegate && [_delegate respondsToSelector:@selector(chooseBtnClicked:)]) {
        [_delegate chooseBtnClicked:btn];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
